//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS BedrockDataAutomationRuntime service.
///
/// Amazon Bedrock Data Automation Runtime
public struct BedrockDataAutomationRuntime: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the BedrockDataAutomationRuntime client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            amzTarget: "AmazonBedrockKeystoneRuntimeService",
            serviceName: "BedrockDataAutomationRuntime",
            serviceIdentifier: "bedrock-data-automation-runtime",
            signingName: "bedrock",
            serviceProtocol: .json(version: "1.1"),
            apiVersion: "2024-06-13",
            endpoint: endpoint,
            errorType: BedrockDataAutomationRuntimeErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// API used to get data automation status.
    @Sendable
    @inlinable
    public func getDataAutomationStatus(_ input: GetDataAutomationStatusRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetDataAutomationStatusResponse {
        try await self.client.execute(
            operation: "GetDataAutomationStatus", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// API used to get data automation status.
    ///
    /// Parameters:
    ///   - invocationArn: Invocation arn.
    ///   - logger: Logger use during operation
    @inlinable
    public func getDataAutomationStatus(
        invocationArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetDataAutomationStatusResponse {
        let input = GetDataAutomationStatusRequest(
            invocationArn: invocationArn
        )
        return try await self.getDataAutomationStatus(input, logger: logger)
    }

    /// Async API: Invoke data automation.
    @Sendable
    @inlinable
    public func invokeDataAutomationAsync(_ input: InvokeDataAutomationAsyncRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> InvokeDataAutomationAsyncResponse {
        try await self.client.execute(
            operation: "InvokeDataAutomationAsync", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Async API: Invoke data automation.
    ///
    /// Parameters:
    ///   - blueprints: Blueprint list.
    ///   - clientToken: Idempotency token.
    ///   - dataAutomationConfiguration: Data automation configuration.
    ///   - dataAutomationProfileArn: Data automation profile ARN
    ///   - encryptionConfiguration: Encryption configuration.
    ///   - inputConfiguration: Input configuration.
    ///   - notificationConfiguration: Notification configuration.
    ///   - outputConfiguration: Output configuration.
    ///   - tags: List of tags.
    ///   - logger: Logger use during operation
    @inlinable
    public func invokeDataAutomationAsync(
        blueprints: [Blueprint]? = nil,
        clientToken: String? = InvokeDataAutomationAsyncRequest.idempotencyToken(),
        dataAutomationConfiguration: DataAutomationConfiguration? = nil,
        dataAutomationProfileArn: String,
        encryptionConfiguration: EncryptionConfiguration? = nil,
        inputConfiguration: InputConfiguration,
        notificationConfiguration: NotificationConfiguration? = nil,
        outputConfiguration: OutputConfiguration,
        tags: [Tag]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> InvokeDataAutomationAsyncResponse {
        let input = InvokeDataAutomationAsyncRequest(
            blueprints: blueprints, 
            clientToken: clientToken, 
            dataAutomationConfiguration: dataAutomationConfiguration, 
            dataAutomationProfileArn: dataAutomationProfileArn, 
            encryptionConfiguration: encryptionConfiguration, 
            inputConfiguration: inputConfiguration, 
            notificationConfiguration: notificationConfiguration, 
            outputConfiguration: outputConfiguration, 
            tags: tags
        )
        return try await self.invokeDataAutomationAsync(input, logger: logger)
    }

    /// List tags for an Amazon Bedrock Data Automation resource
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// List tags for an Amazon Bedrock Data Automation resource
    ///
    /// Parameters:
    ///   - resourceARN: 
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceARN: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceARN: resourceARN
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Tag an Amazon Bedrock Data Automation resource
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> TagResourceResponse {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Tag an Amazon Bedrock Data Automation resource
    ///
    /// Parameters:
    ///   - resourceARN: 
    ///   - tags: 
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceARN: String,
        tags: [Tag],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> TagResourceResponse {
        let input = TagResourceRequest(
            resourceARN: resourceARN, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Untag an Amazon Bedrock Data Automation resource
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UntagResourceResponse {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Untag an Amazon Bedrock Data Automation resource
    ///
    /// Parameters:
    ///   - resourceARN: 
    ///   - tagKeys: 
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceARN: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UntagResourceResponse {
        let input = UntagResourceRequest(
            resourceARN: resourceARN, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }
}

extension BedrockDataAutomationRuntime {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: BedrockDataAutomationRuntime, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}
